<!doctype html>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<html>
<f:view>
<f:loadBundle var="messages" basename="messages"></f:loadBundle>
<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['system_title']}" /></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- styles -->
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/custom.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="<%=request.getContextPath()%>/js/html5.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/icon/favicon.png">
    
    <link rel="stylesheet"
	href="<%=request.getContextPath()%>/plugins/code/prettify.css" />
<script charset="utf-8"
	src="<%=request.getContextPath()%>/kindeditor.js"></script>
<script charset="utf-8"
	src="<%=request.getContextPath()%>/lang/zh_CN.js"></script>
<script charset="utf-8"
	src="<%=request.getContextPath()%>/plugins/code/prettify.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/flexpaper/js/flexpaper_flash.js"></script>
    <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":"+ request.getServerPort() + path + "/";
	
	String  outline = (String)session.getAttribute("outlineFilePath") ;
	
	String  eval = (String)session.getAttribute("evaluFilePath") ;
		
	String outlineUrl = basePath + "tempfile/outline/"+session.getAttribute("outlineFilePath");
	
	
	String evaluUrl = basePath + "tempfile/evaluation/"+session.getAttribute("evaluFilePath");
	
	String  outlineIsPDF = ""+outlineUrl.toUpperCase().endsWith(".PDF");
	String evaluIsPDF = ""+evaluUrl.toUpperCase().endsWith(".PDF");
%>
</head>
<base href="<%=basePath%>">
<body class="bg-white" onload="showOutline()" style="overflow-x:hidden;">
	<h:form id="formid">
		<h:inputHidden value="#{courseQualityAction.courseId}"></h:inputHidden>
		<h:inputHidden value="#{courseQualityAction.outline}" id="hideOutlineId"></h:inputHidden>
		<h:inputHidden value="#{courseQualityAction.courseEva}" id="hideCourseEvaId"></h:inputHidden>
		<h:inputHidden value="#{courseQualityAction.showEditOutline}" id="showEditOutlineFlagId"></h:inputHidden>
		<h:inputHidden value="#{courseQualityAction.showEditEvaluation}" id="showEditEvaluationId"></h:inputHidden>
		<div class="row page-head">
			<h3 class="page-title">
				<i class="n-icon-selection  n-icon-black"></i><h:outputText value="#{messages['course_page_approve_quality_title']}"/>&nbsp;&gt;&nbsp;<b><h:outputText value="#{messages['online_page_select_action_browse']}" /></b>
			</h3>
		</div>
		<div style="margin-left: 20px;margin-right: 20px">
			 <div class="see-info row-fluid">
               	<div class="span3">
                 	 <h:graphicImage id="image" url="/tempfile/#{courseQualityAction.course.image}" height="190px" width="156px"></h:graphicImage>
                 </div>
                  <dl class="dl-horizontal span8">
                    <dt><h:outputText value="#{messages['online_page_select_action_browse_couse_name']}"/></dt>
                    <dd>&nbsp;<h:outputText value="#{courseQualityAction.course.course_name}"/></dd>
                    
                    <dt><h:outputText value="#{messages['teaching_group_pages_title']}"/></dt>
                    <dd>&nbsp;<h:outputText value="#{courseQualityAction.course.teaching_group_name}"/></dd>
                    
                    <dt><h:outputText value="#{messages['online_page_select_action_browse_teacher']}"/></dt>
                    <dd>&nbsp;<h:outputText value="#{courseQualityAction.course.teacherName}"/></dd>
                    
                    
                    <dt><h:outputText value="#{messages['online_page_select_action_browse_star_level']}"/></dt>
                    <dd>&nbsp;<h:outputText value="#{courseQualityAction.course.start_level}"/><h:outputText value="#{messages['online_page_select_star']}"/></dd>
                    
                    <dt><h:outputText value="#{messages['release_course_page_high_quality']}"/></dt>
                    <dd>&nbsp;<h:outputText value="#{courseQualityAction.course.is_high_quality_name}"/></dd>
                    
                    <dt><h:outputText value="#{messages['online_page_select_action_browse_students']}"/></dt>
                    <dd>&nbsp; 
                    	<h:outputFormat value="#{messages['online_page_select_action_browse_students_number']}">
						   <f:param value="#{courseQualityAction.course.studyUsers}"/> 
						</h:outputFormat>
                    
                    </dd>
                    
                  </dl>

              </div>
              <a id="viewDiv"></a>	
              <ul class="nav nav-tabs" id="myTab">
                  <li id="basicInfo-li" class="active" ><a href="#basicInfo"><h:outputText value="#{messages['online_page_select_action_browse_tab_base']}"/></a></li>
                  <li id="teacher-li"><a href="#teacher"><h:outputText value="#{messages['online_page_select_action_browse_tab_teacher']}"/></a></li>
                  <li id="curriculum-li"><a href="#curriculum"><h:outputText value="#{messages['online_page_select_action_browse_tab_course']}"/></a></li>
                  <li id="student-li"><a href="#student"><h:outputText value="#{messages['online_page_select_action_browse_tab_judge']}"/></a></li>
                  <li id="outline-li"><a href="#outline" onclick="onLoadOutline();">&nbsp;&nbsp;&nbsp;<h:outputText value=" #{messages['course_page_course_outline_title']} "/>&nbsp;&nbsp;&nbsp;</a></li>
                  <li id="evalu-li"><a href="#evaluationDiv" onclick="onLoadEvalu();"><h:outputText value=" #{messages['course_page_course_evaluation_title']} "/></a></li>
              </ul>
              
               <div class="tab-content">
               		 <div class="tab-pane active" id="basicInfo">
               		 	<fieldset>
               		 		 <div class="form-white label-auto">
               		 		 	<div class="control-group  no-mb">
                                  <label class="control-label" for=""><h:outputText value="#{messages['online_page_select_action_browse_des']}"/></label>
                                  <div class="controls">
                                    <label class="control-label label-w-auto"><h:outputText value="#{courseQualityAction.course.descripte}" escape="false"/></label>
                                    <span class="help-inline"></span>
                                  </div>
                                </div>
               		 		 </div>
               		 	</fieldset>
               		 	<div class="form-actions">
                            <h:commandButton value="#{messages['course_page_approve_quality_add']}" styleClass="btn btn-primary" action="#{courseQualityAction.doQuality}"  ></h:commandButton>
                            <h:commandButton value="#{messages['course_page_approve_quality_cancel']}" styleClass="btn" action="#{courseQualityAction.cancelQuality}"  ></h:commandButton>
 							<h:commandButton value="#{messages['btn_back']}" styleClass="btn" action="main" />
                        </div>
               		 </div>
               		 <div class="tab-pane" id="teacher">
               		 	<fieldset>
               		 	<div class="form-white label-auto">
             		 		 	<div class="control-group  no-mb">
                                <label class="control-label" for=""></label>
                                <div class="controls">
                                  <label class="control-label label-w-auto"><h:outputText value="#{courseQualityAction.course.teacherDes}"   style="word-break:break-all" styleClass="outputText"></h:outputText></label>
                                </div>
                              </div>
             		 	</div>
               		 	</fieldset> 
               		 	 
               		 </div>
	                 <div class="tab-pane" id="curriculum">
	                 	<div class="accordion" id="accordion1">
		           			<a4j:outputPanel id="refresh">
			           			<a4j:repeat var="content"
										value="#{courseQualityAction.courseChapterList}">
										<h:outputText value="#{content.title1}" escape="false"></h:outputText>
	
										<h:outputText value="#{content.title2}" escape="false"></h:outputText>
	
										<a4j:repeat var="contentVar" value="#{content.ccList}">
											<f:verbatim>
												<li>
											</f:verbatim>
											
											<h:commandLink style="margin-left: 20px"
												value="#{contentVar.section_file_name}[#{contentVar.section_file_type}]"
												action="#{courseQualityAction.showCourseContent}">
												<f:param name="chapterId" value="#{contentVar.id}"></f:param>
											</h:commandLink>
	
											<f:verbatim>
												</li>
											</f:verbatim>
										</a4j:repeat>
										
										<a4j:repeat var="cmVar" value="#{content.xjMList}">
											<f:verbatim>
												<li>
											</f:verbatim>
											<h:outputText value="#{cmVar.xtitle1}" escape="false"></h:outputText>
												<a4j:repeat var="mv" value="#{cmVar.ccmList}">
													<f:verbatim>
														<li>
													</f:verbatim>
												
													<h:commandLink style="margin-left: 20px"
														value="#{mv.section_file_name}[#{mv.section_file_type}]"
														action="#{courseQualityAction.showCourseContent}">
														<f:param name="chapterId" value="#{mv.id}"></f:param>
													</h:commandLink>
													<f:verbatim>
														</li>
													</f:verbatim>
												</a4j:repeat>
											<h:outputText value="#{cmVar.xtitle2}" escape="false"></h:outputText>
											<f:verbatim>
												</li>
											</f:verbatim>
										
										</a4j:repeat>
										
										<h:outputText value="#{content.title3}" escape="false"></h:outputText>
									</a4j:repeat>
		           			</a4j:outputPanel>
		                  </div><!-- /.accordion -->
	                 
	                 </div>
	                 <div class="tab-pane" id="student">
	                 	<div class="table-white">
							<h:dataTable id="listtableinfo"
								value="#{courseQualityAction.markedList}" var="cour" cellpadding="2"
								cellspacing="1" styleClass="table table-hover" >
								<h:column>
									<f:facet name="header">
										<h:outputText value="#{messages['online_page_select_star_level']}"></h:outputText>
									</f:facet>
									<h:outputText value="#{cour.starLevel}"></h:outputText>
								</h:column>
								
								<h:column>
									<f:facet name="header">
										<h:outputText value="#{messages['online_page_select_marked_content']}"></h:outputText>
									</f:facet>
									<h:outputText value="#{cour.content}"></h:outputText>
								</h:column>
											
								<h:column>
									<f:facet name="header">
										<h:outputText value="#{messages['online_page_select_marked_time']}"></h:outputText>
									</f:facet>
									<h:outputText value="#{cour.markTime}"></h:outputText>
								</h:column>	
								
								<h:column>
									<f:facet name="header">
										<h:outputText value="#{messages['online_page_select_marked_student']}"></h:outputText>
									</f:facet>
									<h:outputText value="#{cour.strStudentName}"></h:outputText>
								</h:column>			
											
							</h:dataTable>
						</div>		
	                 	
	                 </div>
	                 
	                 
	                  <div class="tab-pane" id="outline">
						<div class="list-white">
							<h:outputText id="showOutlineDiv" escape="false" rendered="#{courseReleaseApprovalAction.showEditOutline}"></h:outputText>
							<%
								String url = outlineUrl.toUpperCase() ;
								if(url.endsWith(".PDF")){
							%>
								<div id="pdfDivID" style="margin-left:60px;width:900px;height:800px;display: none">
									<!--[if IE]>  
									    <object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="1050" border="0">   
									        <param name="_Version" value="65539">  <param name="_ExtentX" value="20108">  
									        <param name="_ExtentY" value="10866">  <param name="_StockProps" value="0">  
									        <param name="SRC" value="<%=outlineUrl%>">  
									    </object>  
									 <![endif]-->
									 <!--[if !IE]> <!-->  
										<object data="<%=outlineUrl%>" type="application/pdf" width="100%" height="800px">  
									    	alt : <a href='http://get.adobe.com/cn/reader'>Adobe Reader.pdf </a>  
									    </object> 
									 <!-- <![endif]-->
								</div>
							<%
								}else{
							%>
								<div id="viewerPlaceHolder" style="display: none;width:900px;height:800px;"> </div>  
							<%
								}
							%>
						</div>
					</div>
					<div class="tab-pane" id="evaluationDiv">
						<div class="list-white">
							<h:outputText escape="false" rendered="#{courseReleaseApprovalAction.showEditEvaluation}"></h:outputText>
							<%
									String vurl = evaluUrl.toUpperCase() ;
									if(vurl.endsWith(".PDF")){
								%>
									<div id="pdfEvaluDivID" style="margin-left:60px;width:900px;height:800px;display: none">
										<!--[if IE]>  
										    <object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="1050" border="0">   
										        <param name="_Version" value="65539">  <param name="_ExtentX" value="20108">  
										        <param name="_ExtentY" value="10866">  <param name="_StockProps" value="0">  
										        <param name="SRC" value="<%=evaluUrl%>">  
										    </object>  
										 <![endif]-->
										 <!--[if !IE]> <!-->  
											<object data="<%=evaluUrl%>" type="application/pdf" width="100%" height="800px">  
										    	alt : <a href='http://get.adobe.com/cn/reader'>Adobe Reader.pdf </a>  
										    </object> 
										 <!-- <![endif]-->
									</div>
								<%
									}else{
								%>
									<div id="viewerEvaluDiv" style="width:900px;height:800px;display: none"></div>
								<%
									}
								%>
						</div>
					</div>
               </div>
              
	</h:form>
	<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
	<script src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
	<script>
	$(function(){
		
		//标签
		$('#myTab a').click(function (e) {
		  	e.preventDefault();
		  	$(this).tab('show');
		});
		//document.getElementById('viewDiv').scrollIntoView();
		
		//这部分是布局框架，必须最后加载！
	     windowResize();
	     $(window).resize(function() {
	     	windowResize();
	     });
	     
	});
	
	function windowResize(){     
		if(768>=$(window).width()){
			$('#main').css('height','auto');
		}else{
			var h2=$('#header').height() || $('#header').outerHeight(true);
			var h1=$('#footer').height() || $('#footer').outerHeight(true); ;
			var h3=$(window).height() || $(document.body).outerHeight(true);
			var h= h3 - h1 - h2;
			$('#main').css('height','auto');
			$('#content').css('height','100%');
			$('#sidebar').css('height','100%');
			if($('#sidebar').height() >= h){
				if($('#sidebar').height() >= $('#content').height()){
					$('#main').css('height',$('#sidebar').height());
				}else{
					$('#main').css('height',$('#content').height());
				}
			}else if($('#content').height()>= h){
				if($('#sidebar').height() >= $('#content').height()){
					$('#main').css('height',$('#sidebar').height());
				}else{
					$('#main').css('height',$('#content').height());
				}
			}else{
				$('#content').css('height','100%');
				$('#sidebar').css('height','100%');
				$('#main').css('height','auto');
				$('#main').css('height',h);
			}
		
		}
	}
	
	function showOutline(){
		 //document.getElementById("showOEvauDiv").innerHTML = document.getElementById("formid:hideCourseEvaId").value;
	     //document.getElementById("showOutlineDiv").innerHTML = document.getElementById("formid:hideOutlineId").value;
	}
	
	var outline = false ;
	outlinep = '<%=outline%>' ;
	outlineUrl = '<%=outlineUrl%>' ;
	function onLoadOutline(){
		if(outline || outlinep == null || outlinep == '' || outlinep == 'null')
			return ;
		var flag = document.getElementById("formid:showEditOutlineFlagId").value;
	     if(!flag || flag == 'false'){
	    	 outline = true ;
	    	 var a  = '<%=outlineIsPDF%>' ;
	    	 if( a == 'true'){
	    		 $('#pdfDivID').show();
	    	 }else{
	    		 //document.write(tmh__make_ad_fodder(outlineUrl, 900, 800));
	    		 $('#viewerPlaceHolder').show();
	    		 $('#viewerPlaceHolder').html(tmh__make_ad_fodder(outlineUrl, 900, 800));
	    	 }
	     }else{
	     	$('#viewerPlaceHolder').hide();
	     	var val = document.getElementById("formid:hideOutlineId").value; 
	 	    document.getElementById("formid:showOutlineDiv").innerHTML = val ;
	     }
	}
	var evalue = false ;
	var evalP = '<%=eval%>';
	function onLoadEvalu(){
		if(evalue || evalP == null || evalP == '' || evalP == 'null')
			return ;
		flag = document.getElementById("formid:showEditEvaluationId").value;
	     if(!flag || flag == 'false'){
	    	 evalue = true ;
	    	 var a  = '<%=evaluIsPDF%>' ;
	    	 if( a == 'true'){
	    		 $('#pdfEvaluDivID').show();
	    	 }else{
	    		 var evaluUrl = '<%= evaluUrl%>' ;
	    		 $('#viewerEvaluDiv').show();
	    		 $('#viewerEvaluDiv').html(tmh__make_ad_fodder(evaluUrl, 900, 800));
	    	 }
	     }else{
	    		$('#viewerEvaluDiv').hide();
	    		document.getElementById("formid:showOEvauDiv").innerHTML = document.getElementById("formid:hideCourseEvaId").value;
	     } 
	}
	
	function tmh__make_ad_fodder(src, width, height){ 
    	src = src.replace(" ", ""); 
    	var TEMP_IMAGE = '<img src="'+src+'" height='+height+'" width="'+width+'" border="0" />'; 
    	var TEMP_FLASH = '<div id="viewerPlaceHolder" style="width:900px;height:800px;margin-left:100px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' 
    	+ ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" ' 
    	+ ' height="'+height+'" width="'+width+'"> ' 
    	+ '<param name="movie" value="'+src+'" /> ' 
    	+ '<param name="quality" value="high" /> ' 
    	+ '<param name="wmode" value="opaque" /> ' 
    	+ '<EMBED src="'+src+'" quality="high" WIDTH="'+width+'" HEIGHT="'+height+'" ' 
    	+ ' wmode="opaque" TYPE="application/x-shockwave-flash" ' 
    	+ ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> ' 
    	+ '</object></div>'; 
    	return (/\.swf$/gi.test(src) == true ? TEMP_FLASH : TEMP_IMAGE) 
    	.replace(/\$src\$/gi, src) 
    	.replace(/\$width\$/gi, width) 
    	.replace(/\$height\$/gi, height);
	}
	</script>
</body>
</f:view>
</html>
